<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>购物车结算</title>
    <link rel="stylesheet" href="main.css">
</head>
<body>
<div id="app">
    <div v-if="info.length > 0">
        <table>
            <caption>购物车结算</caption>
            <thead>
            </thead>
            <tbody>
            <tr>
                <th>编号</th>
                <th>书籍名称</th>
                <th>出版日期</th>
                <th>价格</th>
                <th>购买数量</th>
                <th>操作</th>

            </tr>

            <tr v-for="(item, index) in info">
                <td>{{ item.id }}</td>
                <td> {{item.name}}</td>
                <td>{{ item.date }}</td>
                <td>{{ item.price }}</td>
                <td>
                    <button v-on:click="decreaseItem(index)" v-bind:disabled="item.count <= 1">-</button>
                    {{ item.count }}
                    <button v-on:click="increaseItem(index)">+</button>
                </td>
                <td>
                    <button v-on:click="removeItem(index)">删除</button>
                </td>
            </tr>

            </tbody>
            <tfoot>

            </tfoot>
        </table>
        <h2>总价：{{ totalPrice }}</h2>
    </div>

    <div v-else>无书籍需要结算</div>
</div>


<script type="module" src="main.js"></script>
</body>
</html>